package sql.db;

import java.io.Serializable;
import java.util.*;

public class ForeignKey implements Serializable
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private ArrayList<String> col_names = null;
	private String ref_table = null;
	private ArrayList<String> ref_cols = null;
	
	public ForeignKey() {
		super();
		col_names = new ArrayList<String>();
		ref_table = null;
		ref_cols = new ArrayList<String>();
	}
	
	public ForeignKey(ArrayList<String> col_names, String ref_table, ArrayList<String> ref_cols) {
		super();
		setCol_names(col_names);
		setRef_table(ref_table);
		setRef_cols(ref_cols);
	}
	
	public String toString() {
		String str;
		str = col_names.toString() + "\t" + ref_table + "\t" + ref_cols.toString() + "\n";
		return str;
	}

	public ArrayList<String> getCol_names() {
		return col_names;
	}

	public void setCol_names(ArrayList<String> col_names) {
		this.col_names = new ArrayList<String>();
		
		if (col_names != null) {
			for (int i = 0 ; i < col_names.size(); i++)
				this.col_names.add(col_names.get(i).toLowerCase());
		}
	}

	public String getRef_table() {
		return ref_table;
	}

	public void setRef_table(String ref_table) {
		this.ref_table = ref_table;
	}

	public ArrayList<String> getRef_cols() {
		return ref_cols;
	}

	public void setRef_cols(ArrayList<String> ref_cols) {
		this.ref_cols = new ArrayList<String>();
		
		if (ref_cols != null) {
			for (int i = 0 ; i < ref_cols.size(); i++)
				this.ref_cols.add(ref_cols.get(i).toLowerCase());
		}
	}
}
